<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<logic:present name="usuario">
    <tiles:insert definition="mensaje"></tiles:insert>
    <div id="paginador"></div> <p>Muestra hasta 4 resultados </p>
    <div id="tableContainer" class="tableContainer">
        <table id="tablaDatos" border="0" cellpadding="0" cellspacing="0" width="30%" class="scrollTable">
            <thead class="fixedHeader" id="fixedHeader">
                <tr>
                    <th> Usuario</th>
                    <th> Unidad representante</th>
                    <th> Contacto</th>
                    <th> Modificar</th>
                    <th> Eliminar </th>
                </tr>
            </thead>   
            <tbody class="scrollContent">
                <tr>
                    <td>
                        <bean:write name="usuario" property="usuario"/>
                    </td>
                    <td>
                        <bean:write name="usuario" property="categoria"/>
                    </td>
                    <td>
                        <bean:write name="usuario" property="contacto"/>
                    </td>
                    <td>
                        <html:form action="/modificarUsuario?method=populate" onsubmit="return this">
                            <html:hidden property="usuario"></html:hidden>
                            <div class="buttons">
                                <button type="submit" class="regular">
                                    <img src="interfaz/images/modificar.png" alt=""/>
                                    <bean:message key="boton.modificar" />
                                </button>
                            </div> 
                        </html:form>
                    </td>
                    <td>
                        <html:form action="/eliminarUsuario" onsubmit="return confirmarEliminarUsuario(this)">
                            <html:hidden property="usuario"></html:hidden>
                            <div class="buttons">
                                <button type="submit" class="negative">
                                    <img src="interfaz/images/eliminar.png" alt=""/>
                                    <bean:message key="boton.eliminar" />
                                </button>
                            </div> 
                        </html:form>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</logic:present>
<script type="text/javascript">

    var p = new Paginador(
    document.getElementById('paginador'),
    document.getElementById('tablaDatos'),
    4
);

    p.Mostrar();
</script>

